package baduga.client;

import baduga.core.Core_JsonDataSchema;
import baduga.core.Core_Messages;
import baduga.karo.CreateNewTable;
import baduga.karo.ExitScreen;
import baduga.karo.LoginScreen;
import baduga.karo.TableGame;
import baduga.karo.TableListScreen;


public final class Controler {
	
	/** Network API*/
	private static Network_Api netwAPI = new Network_Api();
	
	/** GUI */
	public static LoginScreen guiLogScr;
	public static CreateNewTable guiCrNewTab;
	public static ExitScreen guiExScr;
	public static TableListScreen guiTabListScr;
	public static TableGame guiTabGame;
	//public LoginScreen guiLogScr;


	
	
	public Controler()
	{
		/** Inicjalizacja klasy statycznej*/
		Core_Messages.init();;
	}

	
	
	
	
	/**
	 * Fasada dla funkcji connect
	 * 
	 * @param hostname
	 * @param port
	 * @return
	 */
	public boolean fConnect(String hostname, int port)
	{
		netwAPI.connect(hostname, port);
		
		return Network_Api.isConnected();
	}
	
	
	
	/**
	 * Fasada dla funkcji disconnect
	 * 
	 * @param hostname
	 * @param port
	 * @return
	 */
	public boolean fDisconnect()
	{
		return netwAPI.disconnect();
	}
	
	
	/**
	 * Fasada dla funkcji SendData
	 * 
	 * @param hostname
	 * @param port
	 * @return
	 */
	public boolean  fSendData(Core_JsonDataSchema data)
	{
		
		return netwAPI.sendData(data);
	}
	
	
	
	//------------------ [getters] - #START ------------------
	
	/**
	 * @return the netwAPI
	 */
	public static Network_Api getNetwAPI() {
		return netwAPI;
	}

	//------------------ [getters] - #END ------------------
	
	

	
	
	
	
	
	
	
	
	
	//------------------ [setters] - #START ------------------

	/**
	 * @param netwAPI the netwAPI to set
	 */
	public static void setNetwAPI(Network_Api netwAPI) {
		Controler.netwAPI = netwAPI;
	}

	//------------------ [setters] - #END ------------------

}
